package vistas;
import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;

import java.awt.event.ActionListener;
import java.util.List;

import controlador.ControladorJFCategoria;
import controlador.ControladorJFCompra;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class JFCompra extends javax.swing.JFrame {
	private JPanel JPEntrada;
	private JButton JBRegistrar;
	private JLabel JLIngrediente;
	private JComboBox JCIngrediente;
	private JButton JBCancelar;
	private JTextField JTCantidad;
	private JLabel JLCantidad;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFCompra inst = new JFCompra();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public JFCompra() {
		super();
		initGUI();
	
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Laboratorio   Burguer");
			getContentPane().setLayout(null);
			{
				JPEntrada = new JPanel();
				getContentPane().add(JPEntrada, "Center");
				JPEntrada.setLayout(null);
				JPEntrada.setBorder(BorderFactory.createTitledBorder("Registrar Compra"));
				JPEntrada.setBounds(1, 0, 505, 235);
				{
					JBCancelar = new JButton();
					JPEntrada.add(JBCancelar);
					JBCancelar.setText("Cancelar");
					JBCancelar.setBounds(279, 149, 132, 29);
					JBCancelar.setActionCommand("Cancelar");
				}
				{
					JBRegistrar = new JButton();
					JPEntrada.add(JBRegistrar);
					JBRegistrar.setText("Registrar");
					JBRegistrar.setBounds(120, 149, 128, 29);
					JBRegistrar.setActionCommand("Registrar");
				}
				{
					JLIngrediente = new JLabel();
					JPEntrada.add(JLIngrediente);
					JLIngrediente.setText("Ingrediente comprado:");
					JLIngrediente.setBounds(56, 71, 205, 15);
				}
				{
					JCIngrediente = new JComboBox();
					JPEntrada.add(JCIngrediente);
					JCIngrediente.setBounds(224, 67, 195, 22);
					
				}
				{
					JLCantidad = new JLabel();
					JPEntrada.add(JLCantidad);
					JLCantidad.setText("Cantidad:");
					JLCantidad.setBounds(131, 98, 82, 15);
				}
				{
					JTCantidad = new JTextField();
					JPEntrada.add(JTCantidad);
					JTCantidad.setBounds(225, 95, 43, 22);
				}

			}
			pack();
			this.setSize(520, 273);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	

	public JComboBox getJCIngrediente() {
		return JCIngrediente;
	}

	public void setJCIngrediente(JComboBox jCIngrediente) {
		JCIngrediente = jCIngrediente;
	}

	public JTextField getJTCantidad() {
		return JTCantidad;
	}

	public void setJTCantidad(JTextField jTCantidad) {
		JTCantidad = jTCantidad;
	}
	
	public void llenarcombo()
	{
		
	}
	public void addListener (ActionListener actionListener)
	{
		this.JBCancelar.addActionListener(actionListener);
		this.JBRegistrar.addActionListener(actionListener);
	}
	
	public void setcargarComboIngrediente(List<String> ingrediente) 
	{
		ComboBoxModel JCIngredienteModel =  new DefaultComboBoxModel(ingrediente.toArray());
		JCIngrediente.setModel(JCIngredienteModel);   
	}
	
public void limpiar()
	
	{
	    JTCantidad.setText(" ");
	}
	
	public void  mostrarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
			
	}

}
